/// @tags: DP BinomInversion
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>

using std::cin, std::cout;

namespace BlueQuantum {

typedef long long LL;

constexpr int N = 2e3 + 3, P = 1004535809;

int n;
int F[N], G[N], C[N][N], f[N][N][2], g[N][2], siz[N];
std::vector<int> e[N];

inline LL qpow(LL base, int exp = P - 2) {
  LL res = 1;
  for (; exp; exp >>= 1, base = base * base % P)
    if (exp & 1) res = res * base % P;
  return res;
}

inline void prework() {
  C[0][0] = 1;
  for (int i = 1; i <= n; ++i)
    for (int j = C[i][0] = 1; j <= n; ++j) C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % P;
}

void inc(int &x, int y) {
  x += y;
  if (x >= P) x -= P;
}

void dfs(int u, int fa) {
  int(*cur)[2] = f[u];
  cur[1][0] = cur[1][1] = 1;
  siz[u] = 1;
  for (auto v : e[u]) {
    if (v == fa) continue;
    dfs(v, u);
    int(*las)[2] = f[v];
    for (int i = 0; i <= siz[u]; ++i)
      for (int j = 0; j <= siz[v]; ++j) {
        inc(g[i + j][0], (LL)cur[i][0] * las[j][1] % P);
        inc(g[i + j][1], (LL)cur[i][1] * las[j][1] % P);
        if (i + j) {
          inc(g[i + j - 1][0], (LL)cur[i][0] * las[j][0] % P);
          inc(g[i + j - 1][1], (LL)cur[i][1] * las[j][0] % P);
          inc(g[i + j - 1][1], (LL)cur[i][0] * las[j][1] % P);
        }
      }
    memcpy(cur, g, sizeof(decltype(cur[0])) * (siz[u] + siz[v] + 1));
    memset(g, 0, sizeof(decltype(g[0])) * (siz[u] + siz[v] + 1));
    siz[u] += siz[v];
  }
}

inline int main() {
  cin >> n;
  for (int i = 1, u, v; i < n; ++i) {
    cin >> u >> v, e[u].push_back(v), e[v].push_back(u);
  }
  prework();
  dfs(1, 0);
  for (int i = 0; i < n - 1; ++i) G[i] = (LL)f[1][n - i][1] * qpow(n, n - i - 2) % P;
  G[n - 1] = 1;
  for (int i = 0; i < n; ++i)
    for (int j = i; j < n; ++j)
      ((j - i) & 1) ? inc(F[i], P - (LL)G[j] * C[j][i] % P) : inc(F[i], (LL)G[j] * C[j][i] % P);
  int ans = 0;
  for (int i = n >> 1; i < n; ++i) inc(ans, F[i]);
  cout << ans;
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("throne.in", "r", stdin);
  freopen("throne.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
